import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class UserItem extends StatelessWidget {
  Map userItem;
  bool tapStatus;
  UserItem({Key key, @required this.userItem, this.tapStatus}):super(key:key);
  @override
  Widget build(BuildContext context) {
    var bgColor;
    print(this.tapStatus);
    if (this.tapStatus != null && this.tapStatus) {
      bgColor = Color.fromRGBO(227, 231, 234, 1);
    } else {
      bgColor = Colors.white;
    }
    return Container(
      width: ScreenUtil().setWidth(750),
      height: ScreenUtil().setWidth(130),
      color:bgColor,
      padding: EdgeInsets.all(ScreenUtil().setWidth(20)),
      child: Row(
        children: <Widget>[
          CircleAvatar(
            backgroundImage: NetworkImage(
              this.userItem['headimgurl'] == null ? 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1547632735106&di=a9311dc70751876de625c0b87fa5b890&imgtype=0&src=http%3A%2F%2Fpic2.zhimg.com%2Feb437e8e0e8ec7289f3a48bf67637271_b.jpg' : this.userItem['headimgurl']
            )
          ),
          Expanded(
            child: Container(
              margin: EdgeInsets.only(
                left: ScreenUtil().setWidth(20)
              ),
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: <Widget>[
                  Row(
                    children: <Widget>[
                      Expanded(
                        child: Container(
                          height: ScreenUtil().setWidth(30),
                          margin: EdgeInsets.fromLTRB(0, ScreenUtil().setWidth(7), 0, ScreenUtil().setWidth(15)),
                          child: Text(
                            this.userItem['nickname'] == null ? '没有名字' : this.userItem['nickname'],
                            // 'hahah',
                            maxLines: 1,
                            overflow: TextOverflow.ellipsis,
                            style: TextStyle(
                              fontSize: ScreenUtil().setWidth(30),
                              color: Color.fromRGBO(1, 1, 1, 1)
                            ),
                          ),
                        ),
                      ),
                      // Container(
                      //   padding: EdgeInsets.only(
                      //     top: ScreenUtil().setWidth(8)
                      //   ),
                      //   child: Text(
                      //     this.userItem['last_butt_time'] == null ? '0' : this.userItem['last_butt_time'],
                      //     // 'hahah',
                      //     style: TextStyle(
                      //       color:Color.fromRGBO(142, 142, 142, 1),
                      //       fontSize: ScreenUtil().setWidth(22)
                      //     ),
                      //   ),
                      // )
                    ],
                  )
                ],
              ),
            ),
          )
        ],
      )
    );
  }
}